Uec3.payInvoiceOperationWin= Ext.extend(Ext.UecWindow, {
	constructor:function(config){
		this.payInvoiceItem_grid=this.getitemGrid();
		this.getPageContainer();
		Uec3.payInvoiceOperationWin.superclass.constructor.call(this,this.getInitialConfig(config));
		this.params=config.params||{};
	},
	getInitialConfig:function(config){
		if(!config.showType){
			var config=Ext.apply(config||{},{items:[this.editForm,this.payInvoiceItem_grid,this.readOnlyForm]});
		}else if(config.showType==1){
			
		}
		return config;
	},
	getitemGrid:function(){
		this.payInvoiceItem_record_config=[
			{name : 'id',type : 'int'},{name : 'companyId',type : 'int'},{name : 'code',type : 'string'}, {name : 'documentType',type : 'int'}, {name : 'documentId',type : 'int'}, 
			{name : 'payable',type : 'double'}, {name : 'paid',type : 'double'}, {name : 'unPaid',type : 'double'}, {name : 'payableId',type : 'int'}, {name : 'payablePaid',type : 'double'},
			{name : 'customerId',type : 'int'}, {name : 'customerName',type : 'string'}, {name : 'documentTypeVarName',type : 'string',mapping : 'documentTypeVarName'}
			];
		var payInvoiceItem_record=Ext.data.Record.create(this.payInvoiceItem_record_config);
		this.payInvoiceItem_url_store=new Ext.data.JsonStore({
			url:Uec3.App.Constants.homeUrl+"/payable/base!getPayablesBycustomerId.do",
			root:'root',
			pruneModifiedRecords:true,
			fields:payInvoiceItem_record
		});	
		this.payInvoiceItem_store=new Ext.data.JsonStore(
			{root: "root",
			baseParams:{payInvoiceId:0},
		    url : Uec3.App.Constants.homeUrl+'/payInvoiceItem/base!extList.do',
		    pruneModifiedRecords:true, 
		    fields:payInvoiceItem_record
		});
		var payInvoiceItem_cm = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), 
			{
			header:'操作',
			width:50,
			xtype:'anchorcolumn',
			dataIndex : 'act',
			items:[{text:"删除",scope:this,permissionId:25,handler:this.funDelete}]
			},
			{header : '应付款凭证号',width : 90,css : 'background-color:#ddd;',dataIndex : 'code'}, 
			{header : '供应商',width : 200,css : 'background-color:#ddd;',dataIndex : 'customerName'}, 
			{header : '单据类型',width : 75,css : 'background-color:#ddd;',dataIndex : 'documentTypeVarName'}, 
			{header : '应付款',width : 75,css : 'background-color:#ddd;',align:"right",renderer:showMoney,dataIndex : 'payable'}, 
			{header : '已付款',width : 75,css : 'background-color:#ddd;',align:"right",renderer:showMoney,dataIndex : 'payablePaid'}, 
			{header : '未付款',width : 75,css : 'background-color:#ddd;',align:"right",renderer:showMoney,dataIndex : 'unPaid'}, 
			{header : '支付金额',width : 75,dataIndex : 'paid',align:"right",renderer:showMoney,
			editor:new Ext.form.NumberField({allowBlank: false,allowNegative: false,decimalPrecision:2})
		}]);
		var payInvoiceItem_grid=new Ext.grid.EditorGridPanel({
	        cm:payInvoiceItem_cm,
	        flex:1,
	        viewConfig : {
				forceFit : true,
				getRowClass : function(record,rowIndex,rowParams,store){
					//禁用数据显示红色
					if(record.data.documentType==3){
						return 'x-grid-record-red';
					}else{
						return '';
					}
					
				}
			},
			store : this.payInvoiceItem_store,
			editCount:0,
			selModel : new Ext.grid.RowSelectionModel( {moveEditorOnEnter : true}),
			iconCls : 'icon-grid',
			loadMask : {msg : '数据加载中...'},
			clicksToEdit:1,
			tbar: new Ext.app.ModuleToolbar([{
				text: "添加",
				iconCls:'icon-add',
				scope:this,
				handler: this.funAddItem
			}],{permission:95}),
			stripeRows : true,
			autoScroll : true
		});	
		return payInvoiceItem_grid;
	},
	getPageContainer:function(){
		this.partner_combox=Uec3.App.fieldFactory.getPartnerCombo({hiddenName:'customerId',lookupCallBackEvents:["lookupChange"],grid:[2,3,2,3]},1);
		var codeOfSellerField=new Ext.form.TextField({xtype : 'textfield',name : 'codeOfSeller',grid:[4,3,4,3]});
		this.payInvoice_documentType=Uec3.App.dictionary.getCombo("invoiceType",{hiddenName:"invoiceType",allowBlank:false,grid:[6,3,6,3]});
		var gmtActualPayField=new Ext.form.DateField({name : 'gmtActualPay',allowBlank:false,format : 'Y-m-d H:i:s',grid:[8,3,8,3]});
    	this.editForm=new Ext.FormPanel({
    		frame:true,
    		layout:"uec3grid",
    		height:80,
    		layoutConfig:{
			    hGrid:[6,21,6,17,6,17,6,21],
			    vGrid:[40,20,40]
		    },
    		items:[
    			{xtype:'label',
    			 html:'付&nbsp;&nbsp;&nbsp;&nbsp;款&nbsp;&nbsp;&nbsp;&nbsp;单',
	             style:'text-align:center; font-weight:bold;font-size:24px;font-family:FangSong_GB2312',
	             grid:[3,1,6,1]
    			},
	    		{xtype:'label',text : '单据号:',style:{fontSize:'14px'},grid:[7,1,7,1]},
	    		{xtype : 'textfield',name : 'codeOfBuyer',readOnly :true,style:{background:'#dddddd'},grid:[8,1,8,1]},
	    		{xtype:"label",html:'<hr color="#34A4E0" />',grid:[1,2,8,2]},
    			{xtype:'label',text:'供应商:',grid:[1,3,1,3]},this.partner_combox,
    			{xtype:'label',text:'发票号:',grid:[3,3,3,3]},codeOfSellerField,
    			{xtype:'label',text:'发票类型:',grid:[5,3,5,3]},this.payInvoice_documentType,
    			{xtype:'label',text:'付款日期:',grid:[7,3,7,3]},gmtActualPayField,
    			{xtype:"hidden",name:"id"}
    			
    		]
    	});
    	this.readOnlyForm=new Ext.FormPanel({
    		frame:true,
    		layout:'uec3grid',
    		height:35,
    		layoutConfig:{
    			hGrid:[7,10,6,10,6,10,6,10,6,10,6,10],
				vGrid:[100]
		    },
		    defaults:{
		    	readOnly : true
		    },
    		items:[
    			{xtype:'label',text:"单据状态:"},{xtype : 'textfield',name : 'statusVarName',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '创建人:'},{xtype : 'textfield',name : 'creatorName',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '创建时间:'},{xtype : 'textfield',name : 'gmtCreate',format : 'Y-m-d',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '支付人:'},{xtype : 'textfield',name : 'payerName',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '支付时间:'},{xtype : 'textfield',name : 'gmtPay',format : 'Y-m-d',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '支付金额:'},{xtype : 'textfield',name : 'amount',style:{background:'#dddddd'}}
    		]
    	});
	},
	initEvents:function(){
		this.payInvoiceItem_grid.on('afteredit',this.fE_ItemGrid_afteredit,this);
		this.payInvoiceItem_grid.on('mouseout',this.fE_ItemGrid_afteredit,this);
	},
	fE_ItemGrid_afteredit:function(o){
		var value=o.value;
		var record=o.record;
		var payable=record.get("payable");
		if(value>payable||value==0){
			record.set("paid",payable);
			record.commit();
		}
	},
	fE_ItemGrid_mouseout:function(e){
		var grid=this.payInvoiceItem_grid;
		if(grid.activeEditor){
			grid.editCount++;
			if(editCount==2){
				grid.editCount=0;
				grid.stopEditing();
			}
		}
	},
	funDelete:function(grid, rowIndex, colIndex, item, e){
		var store=grid.getStore();
		var record=grid.getStore().getAt(rowIndex);
		store.remove(record);
	},
	funAddItem:function(){
		var customerId=this.editForm.getForm().findField("customerId").getValue();
		if(!customerId){
			Ext.Msg.alert("信息","请先选择供应商");
			Ext.MessageBox.hide.defer(600,Ext.MessageBox);
			return false;
		}else{
			var records=this.payInvoiceItem_grid.getStore().getRange();
			var ids=[];
			Ext.each(records,function(record){
				ids.push(record.data.payableId);
			});
			var desktop =Uec3.App.getDesktop();   
			desktop.launchWindowByParam("payInvoiceItem_add",{customerId:customerId,idsnot:ids,window:this}); 
		}
	},
	/*新建单据*/
	payInvoiceNew:function(btn){
		redirectUrl("payInvoice_operation");
	},
	/*接手单据*/
    payInvoiceRecieve:function(btn){
    	Ext.Msg.confirm("提示",((this.payInvoice.currentorName==null||this.payInvoice.currentorName=='')?"无人":this.payInvoice.currentorName)+"在处理,确定要接手?",function(btn2){
			if(btn2=="yes"){
				this.formSubmit(btn.url,function(form,action){
					this.buttonAjaxRequest("currentorModify");
				});
			}
		},this);
	},
	/*释放单据*/
	payInvoiceRelease:function(btn){
		var fn=function(form,action){
			var result=action.result;
			this.payInvoice.currentorId=null;
			this.payInvoice.currentorName=null;
			this.buttonAjaxRequest("notCurModify");
		}
		this.formSubmit(btn.url,fn);
	},
	/*payInvoiceReset:function(){
		Ext.Msg.confirm("提示","确定置空所有的行",function(btn){
			if(btn=="yes"){
				initialFormPanel.getForm().reset();
				formSubmit("/initialItem/base!delByInitialId?initialId="+id,function(){
					ds_initialItem.reload();
		        });
			}
		},this);
	},*/
	/*查看付款单列表*/
	payInvoiceView:function(){
		//this.refreshPayInvoiceIndex();
		redirectUrl("payInvoice_index");
	},
	/*refreshPayInvoiceIndex:function(){
		var window =Uec3.App.getDesktop().getWindow("payInvoice_index");   
		if(window){
			var store=window.moduleObj.getObjByKey('payInvoice_store');
			store.reload();
		}   		
	}*/
	/*refreshPayableIndex:function(){
		var window =Uec3.App.getDesktop().getWindowByUecId("payable_index");   
		if(window){
			var store=window.moduleObj.getObjByKey('store');
			store.reload();
		}   		
	}*/
	formSubmit:function(url,fn,scope){
		var result;
		this.partner_combox.enable();
		var payInvoiceJson=Ext.encode(encodeFilte(this.editForm.getForm().getValues()));
		var payInvoiceItems=[];
		Ext.each(this.payInvoiceItem_grid.getStore().getRange(),function(record){
			payInvoiceItems.push(record.data);
		});
		var payInvoiceItemJson=Ext.encode(encodeFilte(payInvoiceItems));
		this.editForm.form.submit({
			url:url,
	        method :"post",
	        scope:this,
	        params:{'payInvoiceJson':payInvoiceJson,'payInvoiceItemJson':payInvoiceItemJson},
	        success:function(form,action){
		        result=action.result;
		        var payInvoice=result.payInvoice;
	      		if(result.success=='OK'){
	      			var id=this.editForm.getForm().findField("id").getValue();
	      			if((!id||id=="")&&payInvoice){
	      				this.changeWindowUecId(payInvoice.codeOfBuyer,payInvoice.id);
	      			}
	      			if(payInvoice)this.updateBasicForm(payInvoice);
	      			if(result.payInvoiceItemList){
						var store=this.payInvoiceItem_grid.getStore();
						Ext.each(result.payInvoiceItemList,function(payInvoiceItem){
							Ext.each(store.getRange(),function(payable){							
								if(payInvoiceItem.payableId==payable.data.payableId){
									payable.set("id",payInvoiceItem.id);
								}
							});
						});
					}
	      			if(result.userId)userId=result.userId;
		  			if(Ext.isFunction(fn))fn.call(scope||this,form,action);
		  		}else{
		  			Ext.Msg.alert('信息',result.success); 
		  		}
	       	},
	        failure:function(form,action){
	        	Ext.Msg.alert('提示','网络问题,操作失败!');
	      	}
		});
		return result;
	},
	/*保存*/
	payInvoiceSave:function(btn){
		this.saveOrSubmit(btn,function(){
			//refreshPayInvoiceIndex();
			this.buttonAjaxRequest("currentorModify");
			Ext.Msg.alert('提示','保存成功');
		});
	},
	/*提交*/
	payInvoiceSubmit:function(btn){
		this.saveOrSubmit(btn,function(){
			//refreshPayInvoiceIndex();
			//refreshPayableIndex();
			this.buttonAjaxRequest("formal");
			Ext.Msg.alert('提示','提交成功');
		});
	},
	saveOrSubmit:function(btn,fn,scope){
		if(this.editForm.getForm().isValid()){
			if(this.isItemGridValid()){
				this.formSubmit(btn.url,function(form,action){
					if(Ext.isFunction(fn))fn.call(scope||this);
				},this);
			}
				
		}else{
			Ext.Msg.alert('提示','请填写必填项');
		}
	},
	/*删除*/
	payInvoiceDelete:function(btn){
		Ext.Msg.confirm("提示","确定删除",function(btn2){
			if(btn2=="yes"){
			   this.formSubmit(btn.url,function(){
			    	Ext.Msg.alert('提示','删除成功');
			    	Ext.Msg.hide.defer(600,Ext.Msg);
			    	this.payInvoiceClose();
			    	//refreshPayInvoiceIndex();
			    });
				
			}
		},this);
	},
	/*打印*/
	payInvoicePrint:function(){
		
	},
	/*关闭*/
	payInvoiceClose:function(){
		this.close();
	},
	updateBasicForm:function(payInvoiceRet){
		if(payInvoiceRet){
			this.editForm.getForm().setValues(payInvoiceRet);
			this.readOnlyForm.form.setValues(payInvoiceRet);
			this.payInvoice=payInvoiceRet;
		}
	},
	//按钮加载
   	buttonAjaxRequest:function(typeId,fn){
   		Uec3.App.Uec3Ajax.request({
		 	url:Uec3.App.Constants.homeUrl+'/payInvoice/buttons.do',
		 	params:{typeId:typeId},
		 	scope:this,
		 	success:function(response,options){
		 		var reslut = Ext.decode(response.responseText);
		 		this.removeButtonPanel()
		 		this.addButtonPanel(reslut.buttons);// 初始按钮
		 		//是否遮罩
   				this.isMark(typeId);
   				//this.doLayout();
   				if(Ext.isFunction(fn))fn(reslut);
   				this.isHideWindowLoadMask();
		 	},
		 	failure:function(){
		 		Ext.MessageBox.alert("信息","加载失败,请重新打开!");
		 		this.payInvoiceClose();
		 	}
		});
   	},
	/*遮罩层*/
	
	isMark:function(typeId){
		this.isMask=false;
		var payInvoiceItem_grid=this.payInvoiceItem_grid;
		var editForm=this.editForm.getForm();
		editForm.findField('codeOfSeller').enable();
		editForm.findField('gmtActualPay').enable();
		this.partner_combox.enable();
		this.payInvoice_documentType.enable();
		this.payInvoiceItem_grid.getTopToolbar().enable();
		this.gridBodyloadMark.hide();
	 	if(typeId=='new'){
	  		
		}else if(typeId=='notCurModify'){
			this.gridBodyloadMark.show();
			this.isMask=true;
			editForm.findField('codeOfSeller').disable();
			editForm.findField('gmtActualPay').disable();
			this.partner_combox.disable();
			this.payInvoice_documentType.disable();
			this.payInvoiceItem_grid.getTopToolbar().disable();
		}else if(typeId=='currentorModify'){
			this.partner_combox.disable();
		}else if(typeId=='formal'){
			editForm.findField('codeOfSeller').disable();
			editForm.findField('gmtActualPay').disable();
			this.partner_combox.disable();
			this.payInvoice_documentType.disable();
			this.payInvoiceItem_grid.getTopToolbar().disable();
			this.gridBodyloadMark.show();
			this.isMask=true;
		}
	},
	show:function(){
		Uec3.payInvoiceOperationWin.superclass.show.call(this);
		if(!this.gridBodyloadMark){
			var html=this.payInvoiceItem_grid.getView().el.select(".x-grid3-body").elements[0];
			this.gridBodyloadMark=new Ext.LoadMaskJUPIT(html);
			this.gridBodyloadMark.hide();
		}
		//if(this.windowLoadMask)this.windowLoadMask=new Ext.LoadMask(this.id,{msg:1});
		
	},
	isItemGridValid:function(){
   		var obj=this.editForm.form.getValues();
   		if(obj.id){
   			return true;
   		}else{
   			if(this.payInvoiceItem_grid.getStore().getCount()>0){
   				var paidError;
   				var index=Ext.each(this.payInvoiceItem_grid.getStore().getRange(),function(record){
   					if(record.get("paid")==0){
   						paidError='支付金额不能为零';
   						return false;
   					}else if(record.get("paid")>record.get("unPaid")){
   						paidError='支付金额大于未支付金额,请重新输入';
   						return false;
   					}
   				});
   				if(paidError){
   					Ext.Msg.alert('提示',paidError);
   					return false;
   				}
   				return true;
   			}else{
   				Ext.Msg.alert('提示','请至少加一条明细记录  ');
   				return false;
   			}
   		}
   		
   	},
   	getPayInvoiceItemRecord:function(obj,type,scope){
		//type:0表示从payable传过来的,1表示从payInvoiceItem传过来的
		var recordType=new Ext.data.Record.create(this.payInvoiceItem_record_config);
		var record=new recordType();
		if(type==0){
			record.set("code",obj.code);
			record.set("customerId",obj.customerId);
			record.set("customerName",obj.customerName);
			record.set("payableId",obj.id);
			record.set("documentTypeVarName",obj.documentTypeVarName);
			record.set("documentType",obj.documentType);
			record.set("payable",obj.payable);
			record.set("unPaid",obj.unPaid);
			record.set("paid",obj.unPaid);
			record.set("payablePaid",obj.paid);
		}else if(type==1){
			record.set("id",obj.id);
			record.set("code",obj.code);
			record.set("customerId",obj.customerId);
			record.set("customerName",obj.customerName);
			record.set("payableId",obj.payableId);
			record.set("documentType",obj.documentType);
			record.set("documentTypeVarName",obj.documentTypeVarName);
			record.set("payable",obj.payable);
			record.set("unPaid",obj.unPaid);
			record.set("paid",obj.unPaid);
			record.set("payablePaid",obj.paid);
		}
		return record;
	},
	partComboEvent:function(){
		var _this=this;
   		this.payInvoiceItem_grid.getStore().removeAll();
   		var customerId=this.editForm.getForm().findField('customerId').getValue();
   		if(!Ext.isEmpty(customerId)){
   			Ext.data.Store
   		this.payInvoiceItem_url_store.load({params:{customerId:customerId},callback:function(){
       		Ext.each(_this.payInvoiceItem_url_store.getRange(),function(payable){
       			var record=_this.getPayInvoiceItemRecord(payable.data,0);
       			_this.payInvoiceItem_grid.getStore().add(record);
       		});
 		}});
   		}
    },
    isHideWindowLoadMask:function(){
    	
    	if(this.maskCount==1){
    		this.windowLoadMask.hide();
    		this.maskCount=0;
    	}else{
    		this.maskCount++;
    	}
    },
    //计算金额
	calAmount:function(){
		var records=this.payInvoiceItem_store.getRange();
     	var amount=0;
    	Ext.each(records,function(record){
    		if(record.get("documentType")==3){
    			amount-=record.get('paid');
    		}else{
				amount+=record.get('paid');	      
    		}
    	});
    	this.readOnlyForm.getForm().findField('amount').setValue(amount);
	},
	afterDocumentshow:function(){
		this.windowLoadMask.show();
   		var params=this.params;
		if(params&&params.id){
			this.editForm.getForm().load({
				url:Uec3.App.Constants.homeUrl+'/payInvoice/base!getPayInvoiceById.do',
   				params:{id:params.id},
   				scope:this,
   				success:function(form,action){
   					if(action.result.success=='OK'){
	   					this.payInvoice=action.result.data;
	   					this.readOnlyForm.form.setValues(this.payInvoice);
	   					this.userId=action.result.userId;
	   					//changeTaskButtonText(payInvoice.codeOfBuyer);
	   					if(this.payInvoice.status==0){
	   						if(this.payInvoice.currentorId==this.userId){
	   							this.buttonAjaxRequest("currentorModify");
	   						}else{
	   							this.buttonAjaxRequest("notCurModify");
	   						}
	   					}else if(this.payInvoice.status==1){
	   						this.buttonAjaxRequest("formal");
	   					}
   						this.payInvoiceItem_grid.getStore().baseParams={'payInvoiceId':Ext.isEmpty(this.payInvoice.id)?0:this.payInvoice.id};
						this.payInvoiceItem_grid.getStore().load();
	   					var partner=action.result.partner;
	   					if(partner){
							this.partner_combox.initializeValue({'name':partner.name,'pyCode':partner.pyCode,'id':partner.id});
						}
   					}else{
   						Ext.Msg.alert("错误",action.result.success);
   					}
   					this.isHideWindowLoadMask();
   				}
			});
			
		}else if(params&&params.payableIds){
			Uec3.App.Uec3Ajax.request({
				url:Uec3.App.Constants.homeUrl+'/payInvoice/base!createFormPayable.do',
   				params:{payableIds:params.payableIds,customerId:params.customerId},
   				scope:this,
   				success:function(form,action){
   					var result=Ext.decode(form.responseText);
   					var payableList=result.payableList;
   					var partner=result.partner;
					if(partner){
						this.partner_combox.initializeValue({'name':partner.name,'pyCode':partner.pyCode,'id':partner.id});
					}
					if(payableList.length>0){
						Ext.each(payableList,function(payable){
							var record=this.getPayInvoiceItemRecord(payable,0);
							this.payInvoiceItem_grid.getStore().add(record);
						},this);
					}
					this.isHideWindowLoadMask();
					this.buttonAjaxRequest("new");
   				},
   				failure:function(){
        			Ext.Msg.alert('网络延迟或断网,请稍后重写打开');
        			this.payInvoiceClose();
				}
			});
		}else{
			this.isHideWindowLoadMask();
			this.buttonAjaxRequest("new");
			
		}
   	},
   	initEvents:function(){
   		Uec3.payInvoiceOperationWin.superclass.initEvents.call(this);
   		if(!this.maskCount)this.maskCount=0;
		Ext.util.Observable.capture(this.editForm.getForm(),function(e,form,action){
			if(e=='actioncomplete'){
				
			}else if(e=='beforeaction'){
				Ext.MessageBox.show({
	                title : "提示",
	                msg : "传输中,请稍后.....",
	                buttons: false,
	                width:200,
	                closable:false,
	                wait:true,
	                modal:false
	            });
			}else if(e=='actionfailed'){
				Ext.MessageBox.hide();
				//this.windowLoadMask.hide();
				Ext.Msg.alert("警告",'表单加载失败,网络延迟或断网,请稍后重写打开',function(){
					this.payInvoiceClose();
				},this);
			}
		},this);
		
		//改变金额显示
		Ext.util.Observable.capture(this.payInvoiceItem_store,function(e){
	        if(e=='add'||e=='remove'||e=='update'||e=='load'){
	        	this.calAmount();
	        } 
		},this);
		Ext.util.Observable.capture(this.payInvoiceItem_grid.getView(),function(e,view,b,c){
	        if(e=='rowsinserted'){
	        	var firstRow=b;
	        	var record=this.payInvoiceItem_store.getAt(firstRow);
	        }else if(e=='rowupdated'){
	        	var firstRow=b;
	        	var record=c;
	        }else if(e=='refresh'){
	        	var records=this.payInvoiceItem_store.getRange();
	        	if(this.isMask&&this.isMask==true){
	        		this.gridBodyloadMark.show();
	        	}
	        }
		},this);
		this.payInvoiceItem_grid.on('afteredit',function(o){
			var record=o.record;
			var payable=record.get('payable');
			if(payable<o.value){
				record.set('received',payable);
			}
		});
		this.on('show',function(){
			this.afterDocumentshow();
	   	},this,{single:true});
	   	this.partner_combox.on("select",this.partComboEvent,this);
	   	this.partner_combox.on("lookupChange",this.partComboEvent,this);
   	}
});

Uec3.payInvoiceOperationWindow = Ext.extend(Ext.app.Module, {
    id: 'payInvoice_operation',
    permissionId:95,
    createWindow : function(params){
   	    var windowId=this.id;
   	    if(params&&params.winId){
   	  	    windowId+="_"+params.winId;
   	    }
        var desktop = this.app.getDesktop(); 
        var win = desktop.getWindowByUecId(windowId);
        if(!win){
            win = desktop.createWindow({
            uecId: windowId,
            title: '付款单',
            params:params,
            width:Ext.max([document.body.clientWidth*0.8,1000]),
            height: Ext.max([document.body.clientHeight*0.8-20,500]),
            iconCls: 'acc-icon',
            constrainHeader: true,
            maximizable: true,
            resizable:true,
            layout:"vbox",
            layoutConfig:{align:'stretch'}
            },Uec3.payInvoiceOperationWin);
        }
        win.show();
   }
});
